#include "membuf.h"

void membuf_t::save(ostream& out) const
{
  out.write((const char*)&buf_len, sizeof(buf_len));
  out.write(buf, buf_len);
}

void membuf_t::load(istream& in)
{
  in.read((char*)&buf_len, sizeof(buf_len));
  delete [] buf;
  buf = new char[buf_len];
  in.read(buf, buf_len);
}
